﻿namespace MsTestUtilities.Utilities
{
    public interface IAssertionResult
    {
        bool AssertionHolds { get; }

        string AssertionError { get; }
    }

    public class AssertionResult : IAssertionResult
    {
        public static readonly AssertionResult Success = new AssertionResult(string.Empty);

        public static AssertionResult Error(string errorMessage)
        {
            return new AssertionResult(errorMessage);
        }

        public static AssertionResult Error(string errorMessage, params object[] args)
        {
            return new AssertionResult(string.Format(errorMessage, args));
        }

        public bool AssertionHolds
        {
            get { return AssertionError == string.Empty; }
        }

        public string AssertionError { get; private set; }

        private AssertionResult(string errorMessage)
        {
            AssertionError = errorMessage;
        }
    }
}
